#ifndef _RTC_H
#define _RTC_H

#include <cdefBf531.h>

struct RTC_YMD
{
    short Year;
    short Month;
    short Day;
};

struct RTC_HMS
{
    short Hour;
    short Minute;
    short Second;
};

extern "C" struct RTC_YMD gRTCSysDate;
extern "C" struct RTC_HMS gRTCSysTime;

extern "C" short RTC_GetDaysOfMonth( short year, short month );
extern "C" unsigned int RTC_GetPhysicCount( void );

extern "C" void RTC_GetDate( unsigned int tick, struct RTC_YMD *pYMD );
extern "C" void RTC_GetTime( unsigned int tick, struct RTC_HMS *pHMS );

inline void RTC_GetNowDate( struct RTC_YMD *pYMD )
{                             
    RTC_GetDate(*pRTC_STAT, pYMD);
}

inline void RTC_GetNowTime( struct RTC_HMS *pHMS )
{                             
    RTC_GetTime(*pRTC_STAT, pHMS);
}

extern "C" void RTC_SetRTC( const struct RTC_YMD *pYMD, const struct RTC_HMS *pHMS );
extern "C" void RTC_Init( void );

#endif
